<?php
/*! \brief
 * This is WFCliFactory class
 * This is a factory class that creates cli object
 * \author William Su
 */
class WFCliFactory
{
    /**
     * @var WF
     */
    private $objFramework;
    private static $instance;
    public function __construct($objFramework){
        $this->objFramework = $objFramework;
    }
    public static function getDirnameFile(){
        if(!isset(self::$instance[__FUNCTION__])){
            self::$instance[__FUNCTION__] = dirname(__FILE__);
        }
        return self::$instance[__FUNCTION__];
    }
    /**
     * @return WFCli
     */
    public function getCli(){
        if(!isset(self::$instance[__CLASS__][__FUNCTION__])){
            require_once(self::getDirnameFile().'/Cli.php');
            self::$instance[__CLASS__][__FUNCTION__] = new WFCli($this->objFramework);
        }
        return self::$instance[__CLASS__][__FUNCTION__];
    }
}